<template>
  <div class="infoMain">
    <div :class="['bigDiv', { divDisplay: styleClass == true }]">
      <img :src="infoVo.imgPath" alt="" />
      <div class="infoBigDiv">
        <div class="infoBigTitle">
          <a href="#">{{ infoVo.name }}</a>
          <el-rate
            v-model="infoVo.fraction"
            disabled
            text-color="#ff9900"
            disabled-void-color="#666666"
          >
          </el-rate>
        </div>
        <span class="infoBigAutor">
          作者:<span>{{ infoVo.autor }}</span>
        </span>
        <span class="infoBigChapter">
          最新<span>{{ infoVo.chapter }}</span></span
        >
        <span class="infoBigContent">{{ infoVo.content }} </span>
        <div class="infoBigButton">
          <el-button type="danger">开始阅读</el-button>
        </div>
      </div>
    </div>
    <div class="smallDiv">
      <div class="imgDiv">
        <img
          :src="infoVo.imgPath"
          alt=""
          @mouseover="styleClass = true"
          @mouseout="styleClass = false"
        />
      </div>
      <span class="infoSmallTitle">{{ infoVo.name }}</span>
      <span class="infoSmallFraction"
        >评分:
        <el-rate
          v-model="infoVo.fraction"
          disabled
          text-color="#ff9900"
          disabled-void-color="#666666"
        >
        </el-rate>
      </span>
      <span class="infoSmallChapter"
        >最新<span>{{ infoVo.chapter }}</span></span
      >
    </div>
  </div>
</template>
<script>
export default {
  name: 'v-infoMain',
  props: {
    infoVo: {
      type: Object
    }
  },
  data () {
    return {
      styleClass: false
    };
  }

};
</script>
<style lang="less" scoped>
.infoMain {
  width: 168px;
  height: 288px;
  // background-color: chartreuse;
  position: relative;

  .divDisplay {
    opacity: 1 !important;
    transform: scale(1) !important;
    z-index: 4 !important;
  }
}
.infoMain .smallDiv {
  width: 100%;
  height: 100%;
  opacity: 1;
  transition: all 0.5s;
  z-index: 1;
  position: absolute;
  top: 0px;
  .imgDiv {
    width: 100%;
    height: 224px;
    overflow: hidden;
    img {
      width: 100%;
      z-index: 3;
    }
  }
  .infoSmallTitle {
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    display: block;
    width: 100%;
  }
  .infoSmallFraction {
    display: block;
    width: 100%;
    font-size: 10px;
    color: #666666;
    margin-top: 5px;
    .el-rate {
      display: inline;
      margin-left: 6px;
      /deep/ .el-rate__item {
        .el-icon-star-on {
          font-size: 10px;
          margin-right: 3px;
        }
      }
    }
  }
  .infoSmallChapter {
    font-size: 11px;
    display: block;
    width: 100%;
    span {
      color: red;
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
      margin-left: 6px;
    }
  }
}

.infoMain .bigDiv {
  width: 210px;
  height: 340px;
  opacity: 0;
  transition: all 0.5s;
  transform: scale(0.8);
  position: absolute;
  top: -11px;
  left: -21px;
  z-index: 1;
  background-color: rosybrown;
  img {
    width: 100%;
  }
  .infoBigDiv {
    opacity: 0.9;
    width: 100%;
    height: 50%;
    position: absolute;
    top: 50%;
    background-color: #ffffff;

    .infoBigTitle {
      width: 100%;
      height: 40px;
      display: flex;
      justify-content: flex-end;
      a {
        height: 100%;
        width: 58%;
        font-size: 20px;
        font-weight: bold;
        text-decoration: none;
        color: black;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        float: left;
      }
      a:hover {
        color: red;
      }
      .el-rate {
        width: 38%;
        height: 100%;
        float: left;
        /deep/ .el-rate__item {
          .el-rate__icon {
            font-size: 10px;
            margin-right: 3px;
            line-height: 20px;
          }
        }
      }
    }
    .infoBigAutor {
      display: block;
      width: 100%;
      font-size: 14px;
      padding-left: 4%;

      span {
        margin-left: 14px;
        color: #b3b3b3;
      }
    }
    .infoBigChapter {
      display: block;
      width: 100%;
      font-size: 14px;
      padding-left: 4%;
      span {
        margin-left: 15px;
        color: red;
      }
    }
    .infoBigContent {
      display: block;
      width: 100%;
      font-size: 14px;
      padding-left: 4%;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
      overflow: hidden;
    }
    .infoBigButton {
      width: 100%;
      position: absolute;
      bottom: 0px;
      display: flex;
      justify-content: center;
      .el-button {
        width: 96%;
      }
    }
  }
}
.infoMain .bigDiv:hover {
  opacity: 1;
  transform: scale(1);
  z-index: 4;
}
</style>
